<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit"/>
    <meta name="force-rendering" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
    <title>user</title>
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=no">
    <#include "/include/new_resource.html"/>
</head>
<body>
<div class="main">
    <div class="browse-box ">
        <div class="hd g-header">
            <div class="left">
                <div class="logo">
                    <a href="javascript:void(0);"><img src="${base}/static/images/logo.png" alt=""></a>
                </div>
            </div>
            <div class="right">
                <div class="component">
                    <div class="tabs">
                        <a href="${base}/admin/parameters/index">Parameters</a>
                        <a href="${base}/admin/parameters/my_index">My Parameters</a>
                        <a href="${base}/report/list">Report</a>
                        <#if user.departmentId==1>
                            <a class="active" href="${base}/admin/userView/list">User</a>
                        </#if>

                    </div>
                    <#include "/include/user_info.html"/>

                </div>
            </div>
        </div>
        <div class="bd">
            <div class="user-box">
                <div class="user-box-top">
                    <h3>Users</h3>
                    <button type="button"  onclick="HF.goto('${base}/admin/userView/profile?actionType=user')">Add user</button>
                </div>
                <div class="user-box-content g-table">
                    <div class="theader">
                        <ul>
                            <li>
                                <button type="button">name</button>
                            </li>
                            <li>
                                Email
                            </li>
                            <li>
                                Last login
                            </li>
                        </ul>
                    </div>
                    <div class="tbody">
                        <ul>
                            <#if list??&&list?size gt 0>
                            <#list list as t>
                            <li>
                                <div class="name">
                                    <img src="${base}${(t.profilePhoto)!'/static/images/name.png'}" alt="">
                                    <span>${t.userName!}</span>
                                </div>
                                <div class="email">
                                    ${t.email!}
                                </div>
                                <div class="login-time">
                                    ${(t.lastLoginTime?datetime)!}
                                </div>
                                <div class="btns">
                                    <button class="reset-button" type="button" onclick="HF.goto('${base}/admin/userView/profile?actionType=user&id=${t.id?c}')">edit</button>
                                    <button class="deactivate-button" type="button"
                                            onclick="confirmToCancel(${t.id?c},'${t.valid?string("Deactivate","Activate")}')">${t.valid?string('Deactivate','Activate')}</button>
                                </div>
                            </li>
                            </#list>
                            </#if>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 遮罩层 -->
<div class="shade"></div>
<#include "/include/new_js_resource.html"/>
<script type="text/javascript">
    function confirmToCancel(id,status){
        var r= window.confirm(status+"？");
        var url ="${base}/admin/userView/delete?id="+id+'&state='+(status=='Activate'?1:0);
        console.log(url);
        if (r) {
            $.ajax({
                type: "DELETE",
                url: url,
                success: function(data){
                    console.log(data);
                    if(typeof(data)!='undefined'){
                        document.location.reload();
                    }
                },
                error:function(){

                }
            });
        }
    }
</script>
</body>

</html>




